<script>
    function calculatePurchaseTotal(prefix) {
	var total = 0.0;
	total += getVal("#id_service_tax");
	total += getVal("#id_education_cess");
	total += getVal("#id_higher_secondary");
	total += getVal("#id_tds");
	total = total - getVal("#id_discount");
	total += getVal("#id_round_off");

	$("#id_total").val(total.toFixed(2));
    };

    function reverse_calculate() {

    }

    function caluculate_total() {
    }
</script>

<div id="purchasers-popup">
<form id = "id_purchaser_form" name = "purchase_form"  method="post">{% csrf_token %}
  <div style="float:left;width:60%;%">
  <table>
    {{ form.as_table }}
  </table>
  </div>
  <div style="float:left;width:40%;">
    <h2> Passenger Information </h2>
    <div id="paxinfo_{{id}}"></div>
    <script>
      $(function() {
	$.ajax({
	    url: "/purchaseSaleInfo/{{id}}",
	    context: document.body,
	    cache: false,
	    success: function(data){
		$.each(data, function(k, v) {
		    $("#paxinfo_{{id}}").append("&nbsp;<hr />");
		    $.each(v, function(k, v) {
			$("#paxinfo_{{id}}").append("<li>"+k+" : "+v+"</li>");
		    });
		});
	    },
	    error: function(){
		alert('failure');
	    }
	});
    });
    </script>
  </div>
</form>
</div>
